package com.andy.qi.domain;

import java.io.Serializable;

import javax.persistence.Embeddable;

@Embeddable
public class GamePK implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    private String roomUuid;
    private int gameIndex;
    
    
    public GamePK(String roomUuid, int gameIndex) {
        this.roomUuid = roomUuid;
        this.gameIndex = gameIndex;
    }
    
    public GamePK() {
    }
    
    public String getRoomUuid() {
        return roomUuid;
    }
    public void setRoomUuid(String roomUuid) {
        this.roomUuid = roomUuid;
    }
    public int getGameIndex() {
        return gameIndex;
    }
    public void setGameIndex(int gameIndex) {
        this.gameIndex = gameIndex;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + gameIndex;
        result = prime * result + ((roomUuid == null) ? 0 : roomUuid.hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        GamePK other = (GamePK) obj;
        if (gameIndex != other.gameIndex)
            return false;
        if (roomUuid == null) {
            if (other.roomUuid != null)
                return false;
        } else if (!roomUuid.equals(other.roomUuid))
            return false;
        return true;
    }
}